<template>
<div class="big">
  <div>
    <div class="fl">
      <img src="../../assets/images/首页/u30.png">
      <input v-model="input" placeholder="复制淘宝商品名称，搜优惠券返利" />
      <img src="../../assets/images/首页/u70.png" alt="" class="youtu">
      <p>
        <button>推荐</button>&nbsp;
        <button>家电</button>&nbsp;
        <button>食品</button>&nbsp;
        <button>数码</button>&nbsp;
        <button>美妆</button>&nbsp;
        <button>配饰</button>&nbsp;
        <img src="../../assets/images/首页/u79.png" alt="">
      </p>      
    </div>
    <div class="lb">
      <swiper 
        :modules="[Autoplay]"
        direction="horizontal"
        :autoplay="{ delay: 3000 }"
        :slides-per-view="1"
        :centered-slides="false"
        :allow-touch-move="true"
        @swiper="onSwiper"
        @slideChange="onSlideChange"
      >
        <swiper-slide v-for="(image, index) in images" :key="index">
          <img :src="image" alt="轮播图">
        </swiper-slide>
      </swiper>
    </div>

    <p class="tubiao">
      <img src="../../assets/images/首页/u65.png">
      <img src="../../assets/images/首页/u66.png">
      <img src="../../assets/images/首页/u67.png">
      <img src="../../assets/images/首页/u68.png">
      <img src="../../assets/images/首页/u69.png">
    </p>

    <div class="youhui">
      <p class="toutiao">优淘头条距离淘宝库关闭还有10小时，抓紧剁手啊&nbsp;
        <el-icon><ArrowRight /></el-icon>
      </p>
      <ul>
        <li>
          <p>品牌闪购</p>
          <p>买微波炉送大米</p>
          <img src="../../assets/images/首页/u87.png" class="zuo">
          <img src="../../assets/images/首页/u86.png" class="you">
        </li>
        <li>
          <p>畅玩3C</p>
          <p>分享送优惠券</p>
          <img src="../../assets/images/首页/u91.png" class="zuo">
          <img src="../../assets/images/首页/u92.png" class="you">
        </li>
        <li>
          <p>热卖榜单</p>
          <p>热门养生紫砂茶具</p>
          <img src="../../assets/images/首页/u106.png" class="zuo">
          <img src="../../assets/images/首页/u105.png" class="you">
        </li>
        <li>
          <p>精选大牌</p>
          <p>实用好货折上折</p>
          <img src="../../assets/images/首页/u107.png" class="zuo">
          <img src="../../assets/images/首页/u108.png" class="you">
        </li>
      </ul>
    </div>
    <div class="di">
      <p>
        <img src="../../assets/images/首页/u110.png">
        <img src="../../assets/images/首页/u111.png">
        <img src="../../assets/images/首页/u112.png">
        <img src="../../assets/images/首页/u113.png" @click="cart">
        <img src="../../assets/images/首页/u114.png" >
      </p>
    </div>
  </div>
  </div>
</template>

<script setup>
import { ArrowRight} from "@element-plus/icons-vue";
import router from "@/router";
import { Swiper, SwiperSlide } from 'swiper/vue';
import { Autoplay } from 'swiper/modules';

import { ref } from "vue";

const images = ref([
  require('../../assets/images/首页/u34.png'),
  // require('../../assets/images/首页/u40.jpg'),
  // require('../../assets/images/首页/u46.jpg'),
  // require('../../assets/images/首页/u52.jpg'),
  // require('../../assets/images/首页/u58.png'),
]);

const input = ref('');

const onSwiper = (swiper) => {
  console.log('Swiper initialized:', swiper);
};

const onSlideChange = () => {
  console.log('Slide changed');
};

const cart = ()=>{
  router.push('/home/cart')
}
</script>

<style scoped>
.big{
  background-image: url("../../assets/images/首页/u26.png");
  background-repeat: no-repeat;
  background-size: 100% 80%;
  padding-top: 10px;
}
.fl{
  margin-left: 10px;
  margin-right: 10px;
}
.fl img{
  width: 3vh;
  height: 20px;
  margin-left: 5px;
}
.fl .youtu{
  float: right;
}
.fl input{
  border: none;
  border-radius: 6px;
  width: 43vh;
  margin-left: 10px;
}

.fl button{
  background-color: transparent;
  border: none;
  color: white;
  margin-top: 10px;
}
.fl p img{
  width: 2vh;
  height: 15px;
}
.lb {
  height: 20vh;
  display: flex;
  justify-content: center;
  margin-top: 5px;
}

.swiper {
  width: 90%;
  max-width: 800px;
  height: auto;
}

.swiper-slide {
  display: flex;
  justify-content: center;
  align-items: center;
}

.swiper-slide img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: contain;
}
.tubiao img{
  width: 10vh;
  height: 72px;
}
.tubiao{
  padding-left: 20px;
  margin-top: 20px;
}
.youhui{
  background-color: #fafafa;
}
.youhui .toutiao{
  font-size: 14px;
  padding-left: 8px;
}
.youhui ul{
  display: flex;
  flex-wrap: wrap;
  padding-left: 10px;
}
.youhui ul li{
  background-color: white;
  width: 160px;
  height: 160px;
  margin-left: 20px;
}
.youhui ul li .zuo{
  width: 8vh;
  height: 60px;
}
.youhui ul li .you{
  width: 10vh;
  height: 105px;
  margin-left: 10px;
}
.di{
  background-color: #ffffff;
}
.di p{
  padding-left: 10px;
  padding-right: 10px;
}
.di p img{
  width: 4vh;
  height: 32px;
  margin-left: 35px;
}
</style>  